<template>
	<view class="wrap">
		<cu-custom bgColor="bg-gradual-blue" :isBack="true">
			<block slot="backText">返回</block>
			<block slot="content">人员详情</block>
		</cu-custom>
		<view class="list-cell">
			<image class="user-images" :src="userInfo.url"></image>
			<view class="user-name">
				<span>{{userInfo.name}}</span><u-icon v-if="userInfo.sex===0" size="32" color="#f04d94"
					name="woman"></u-icon><u-icon v-else size="32" color="#0346e8" name="man"></u-icon> <br>
				<span class="user-other">员工编号：{{userInfo.number}}</span>
			</view>
		</view>
		<u-gap height="20" bgColor="#f5f5f5"></u-gap>
		<u-cell-group :border="false">
			<u-cell-item title="公司" :value="userInfo.companyName" icon="home" :title-width="180"
				:arrow="false"></u-cell-item>
			<u-cell-item title="所属部门" :value="userInfo.dpname" icon="file-text" :title-width="180"
				:arrow="false"></u-cell-item>
			<u-cell-item title="岗位" :value="userInfo.positionLevel" icon="account" :title-width="180"
				:arrow="false"></u-cell-item>
			<u-cell-item title="手机" class="connect" @click="callPhoneNumber(userInfo.phone)" :value="userInfo.phone"
				icon="phone" :title-width="180" :arrow="false"></u-cell-item>
			<u-cell-item title="邮箱" class="connect" :value="userInfo.email" icon="email" :title-width="180"
				:arrow="false"></u-cell-item>
			<u-gap height="20" bgColor="#f5f5f5"></u-gap>
		</u-cell-group>
	</view>

</template>
<script>
	// import HeadNavBar from '@/components/headnavbar/index';
	/**
	 * Copyright (c) 2013-Now http://aidex.vip All rights reserved.
	 */
	export default {
		components: {
			// HeadNavBar
		},
		data() {
			return {
				userInfo: {}
			}
		},
		onLoad(option) {
			const item = JSON.parse(option.info)
			this.userInfo = {
				...item,
				url: this.goToUrlByUser(item.faceId)
			}
		},
		methods: {

			goToUrlByUser(avatar, token) {
				const userInfo = uni.getStorageSync("userInfo")
				token = userInfo.token
				if (avatar && (avatar.startsWith('http') || avatar.startsWith('https'))) {
					return avatar;
				}
				if (avatar) {
					return `http://192.168.2.188:11042${avatar}?X-Access-Token=zCy_ BeArEr ${token}`
				}
				return "";
			},
			//拨打固定电话
			callPhoneNumber(phone) {
				uni.makePhoneCall({
					phoneNumber: phone,
				});
			},
		}
	};
</script>
<style lang="scss">
	@import 'index.scss';

	page {
		background-color: #f5f5f5;
	}

	.list-cell {
		display: flex;
		box-sizing: border-box;
		width: 100%;
		padding: 10px 24rpx;
		overflow: hidden;
		color: #323233;
		font-size: 14px;
		line-height: 24px;
		background-color: #fff;
		align-items: center;

	}

	.user-images {
		width: 80rpx;
		height: 80rpx;
		margin-right: 10px;
	}

	.user-name {
		font-size: 32rpx;
		color: #000000;

		span {}

		.user-other {
			font-size: 26rpx;
			color: #999999;
			font-weight: normal;
		}
	}
</style>